package com.powernode.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.powernode.dto.VisitLogDto;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.powernode.domain.VisitLog;
import com.powernode.mapper.VisitLogMapper;
import com.powernode.service.VisitLogService;

import java.util.List;

/**
*内容: 
*作者:
*/
@Service
public class VisitLogServiceImpl implements VisitLogService{

    @Resource
    private VisitLogMapper visitLogMapper;

    @Override
    public int insert(VisitLog record) {
        return visitLogMapper.insert(record);
    }

    @Override
    public int insertSelective(VisitLog record) {
        return visitLogMapper.insertSelective(record);
    }

    /**
     * 根据客户ID查询当前客户的拜访数据
     * @param visitLogDto
     * @return
     */
    @Override
    public PageInfo<VisitLog> listVisitLogByCustomerId(VisitLogDto visitLogDto) {
        Page<VisitLog> page= PageHelper.startPage(visitLogDto.getPage(),visitLogDto.getLimit());
        List<VisitLog> visitLogList=this.visitLogMapper.queryVisitLogByCustomerId(visitLogDto.getCustomerId());
        return page.toPageInfo();
    }

}
